<?php

return array(
    'router' => array(
        'routes' => array(
            'product-ajax' => array(
                'type' => 'Literal',
                'options' => array(
                    'route' => '/product-ajax',
                    'defaults' => array(
                        'controller' => 'product-ajax-controller',
                        'action' => 'index'
                    )
                ),
                'may_terminate' => true,
                'child_routes' => array(
                    'product-by-type' => array(
                        'type' => 'Segment',
                        'options' => array(
                            'route' => '/product-type[/:type][/:type_name]',
                            'constraints' => array(
                                'type' => '[1-3]',
                                'type_name' => '[a-z-(.html)?]*'
                            ),
                            'defaults' => array(
                                'controller' => 'product-ajax-controller',
                                'action' => 'list-product-by-type'
                            )
                        )
                    ),
                    'product-detail' => array(
                        'type' => 'Segment',
                        'options' => array(
                            'route' => '/product-detail[/:product_id]-[:product_name]',
                            'constraints' => array(
                                'product_id' => '[0-9]*',
                                'product_name' => '[a-z0-9-(.html)?]*'
                            ),
                            'defaults' => array(
                                'controller' => 'product-ajax-controller',
                                'action' => 'product-detail'
                            )
                        )
                    ),
                    'product-by-category' => array(
                        'type' => 'Segment',
                        'options' => array(
                            'route' => '/[:cat_id][/:cat_name][/sx-:maker_name][/price-:order_by][/price/:price_step][/page-:page]',
                            'constraints' => array(
                              'cat_id' => '[0-9]*',
                              'cat_name' => '[a-z-(.html)?]*',
                              'page' => '[0-9]*',
                              'order_by' => 'up|down',
                              'price_step' => '([0-9]*)-([0-9]*)'
                            ),
                            'defaults' => array(
                                'controller' => 'product-ajax-controller',
                                'action' => 'list-product-by-category',
                                'page' => 1,
                                'order_by' => 'up',
                                'maker_name' => 'all',
                                'price_step' => '0-0'
                            )
                        )
                    )
                )
            )
        )
    ),
    'controllers' => array(
        'invokables' => array(
            'product-ajax-controller' => 'ProductAjax\Controller\ProductAjaxController'
        )
    ),
    'view_manager' => array(
        'template_path_stack' => array(
            __DIR__ . '/../view'
        )
    )
);
